﻿using Furion.DependencyInjection;
using MyProject.Mqtt.Job;
using MyProject.Util.Helper;
using System.Threading.Tasks;

namespace MyProject.Mqtt
{
    public class MqttJobCenter : ITransient
    {
        private MqttWorkTest _mqttWorkTest;

        public MqttJobCenter(MqttWorkTest mqttWorkTest)
        {
            _mqttWorkTest = mqttWorkTest;
        }

        public async Task DoWork(string topic, string msg)
        {
            switch (topic)
            {
                case "Test":
                    await _mqttWorkTest.DoWork(msg);
                    break;

                default:
                    LogHelper.Error("MQTT未设定相应主题执行业务！主题：" + topic);
                    break;
            }
        }
    }
}